﻿using EPiServer;
using EPiServer.DynamicContent;

namespace SocialPack.modules.SocialPack.DynamicContent.Facebook
{
    [DynamicContentPlugIn(
        DisplayName = "Facebook Login Button",
        Description = "Displays Facebook Login Button",
        ViewUrl = "~/modules/socialpack/dynamiccontent/facebook/loginbutton.ascx")]
    public partial class LoginButton : UserControlBase
    {
        public string CountryCode { get; set; }

        public bool ShowFaces { get; set; }

        public int Width { get; set; }

        public int MaxRows { get; set; }

        public string Permissions { get; set; }

        protected override void OnLoad(System.EventArgs e)
        {
            base.OnLoad(e);

            if (!string.IsNullOrWhiteSpace(this.CountryCode))
            {
                this.LoginButtonControl.CountryCode = this.CountryCode;
            }

            this.LoginButtonControl.ShowFaces = this.ShowFaces;
            this.LoginButtonControl.Width = this.Width;
            this.LoginButtonControl.MaxRows = this.MaxRows;

            if (!string.IsNullOrWhiteSpace(this.Permissions))
            {
                this.LoginButtonControl.Permissions = this.Permissions;
            }
        }
    }
}